package com.upeoe.lucrocrawler.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Properties;

/**
 * @author ven_hxz
 * @create 2016-05-22 下午5:07
 */
public class PropsKit {
    private static Properties props = new Properties();
    private static Logger logger = LoggerFactory.getLogger(PropsKit.class);

    static {
        try {
            props.load(Thread.currentThread().getContextClassLoader().
                    getResourceAsStream("config.properties"));
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
    }

    /**
     * 指定键获取对应的属性值
     *
     * @param key
     * @return
     */
    public static String getValue(String key) {
        return props.getProperty(key);
    }
}
